
// Reserved keywords: 
//
// - start, end - start or end file section
// - max_humans - key word, to use all humans on ship for the command; can be placed in the "<max people>" field
//

//
// Comments can be present on a empty line, or after a line with a command / reserved keyword on it.
//

start

  // sub commands - for speed - to test in-game
  //
  Set_speed 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Set_throttle 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )

  Ahead_slow 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Ahead_one_third 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Ahead_standard 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Ahead_full 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Ahead_flank 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )

  Back_slow 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Back_standard 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Back_full 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
  Back_emergency 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )

  All_stop 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )

  // new test commands - working, but not correctly implemented - to fix when the specification list will be completed
  //

//  modified by MFCM  
// Crash_dive currently not getting triggered
  Crash_dive 1 1 4 ( CR_CHIEF = crashd_CHIEF, CR_VALVE = crashd_VALVE, CR_HELM = crashd_HELM, CR_SO_01 = crashd_SO )
  Dive 1 1 4 ( CR_CHIEF = dive_CHIEF, CR_VALVE = dive_VALVE, CR_HELM = dive_HELM, CR_SO_01 = dive_SO )	
  Periscope_depth 1 1 4 ( CR_CHIEF = pscope_CHIEF, CR_VALVE = pscope_VALVE, CR_HELM = pscope_HELM, CR_SO_01 = pscope_SO )
  Snorkel_depth 1 1 4 ( CR_CHIEF = snorkd_CHIEF, CR_VALVE = snorkd_VALVE, CR_HELM = snorkd_HELM, CR_SO_01 = snorkd_SO )
  Surface 1 1 2 ( CR_CHIEF = surf_CHIEF, CR_VALVE = surf_VALVE )
  Emergency_surface 1 1 2 ( CR_CHIEF = esurf_CHIEF, CR_VALVE = esurf_VALVE )
  Set_depth 1 1 1 ( CR_CHIEF = setd_CHIEF )

//workaround for non-funtional Crash_dive
//Set_depth 1 1 4 ( CR_CHIEF = crashd_CHIEF, CR_VALVE = crashd_VALVE, CR_HELM = crashd_HELM, CR_SO_01 = crashd_SO )

//  end modified by MFCM 
  
// doesn't work  Crash_dive 1 1 1 ( CR_CHIEF = crashd_test_script )

// Added by MCCD :
  Propulsion_standard 1 1 1 ( CR_CHIEF = Propulsion_standard )
  Propulsion_recharge 1 1 1 ( CR_CHIEF = Propulsion_recharge )
  
  Get_depth_under_sub_keel 1 1 1 ( CR_NAV = Get_depth_under_sub_keel )
  Report_weather 1 1 1 ( CR_NAV = Report_weather )

// End MCCD
  
  Report_nearest_radio_contact 1 1 1 ( RR_RADIO_A = report_contacts )
  Report_nearest_sound_contact 1 1 1 ( RR_HIDRO = report_sound_contacts )
  WA_Report_damage 1 1 1 ( CR_CHIEF = report_damage )
  Toggle_activate_damage_control_team 1 1 1 ( CR_CHIEF = repair_damage )
  Ahead_full 1 1 1 ( DER_DE_CPO = increase_speed )

  // course commands
  Set_course 1 1 1 ( CR_CHIEF = set_course )
  Return_to_course 1 1 1 ( CR_CHIEF = return_to_course )

  // csaitan: hacky solution to SubSim version, it's only here because we need
  // to call these two game commands.
  Man_the_deck_gun 1 1 1 ( CR_CHIEF = MAN_THE_DECK_GUN )

  // csaitan: hacky solution to French version 25.09.2009
  Man_the_flak_gun 1 1 1 ( CR_CHIEF = MAN_THE_FLAK_GUN )

  Toggle_activate_deck_gun_team 1 1 1 ( CR_CHIEF = TOGGLE_ACTIVATE_DECK_GUN_TEAM )
  Toggle_activate_aa_gun_team 1 1 1 ( CR_CHIEF = TOGGLE_ACTIVATE_AA_GUN_TEAM )

end

// Commands
// ==============================
//
// Format: <name> <cmd priority> <min people> <max people> (< waypoint1 = char_command1, waypoint2 = char_command2 >)
//
// <> - meens that the command must have that parameter.
// () - command must have at least one order. ( order = <waypoint1 = char_command1> ); there can be as many as "max people" orders.
//
// name - command name. there has to be support for it inside the code. ( new commands can't be added on-the-fly. )
//
// cmd priority - command priority for now, starts at 1 and ends at infinity. lowest priority command will be a command with 
//                priority 1. ( need to check with design on this matter, to decide on priorities )
//
// min_people - variable use to determine the minimum amount of humans needed by this command. without mimumum amount of people
//              the command can not be executed initialy, so we'll try to free the minimum amount of people that this command wants by
//              any means necessary: we'll try first to take people for other commands that have more then their minimum, if still 
//              there aren't enough people, we'll start canceling commands from the lower priority ones till the highest priority ones.
// max_people - variable use to determine the maximum amount of humans needed by this command. a command searches for maximum people
//              and if it doesn't find maximum people, it will try to find as many as it can.

//
// The order of the orders matters: if there aren't enough people, and min_people will be used, they will be the first in line to use.
//
// EX: set_speed_de 1 1 2 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port )
//
// if only minimum people found: it will use only the human for the first order ( "CR_HELM = ss_helmsman" ); CR_HELM is the place
// for "Helmsman" job / title / rank, so it have the highest priority for the command.
//
// if maximum people found: it will use both humans.
//

//
// In directory "SilentHunter5\data\Scripts\AI\Crew", every command has a *.aix file containing the strategies for it's humans. 
// In a *.aix file there can be strategies for more command, but things are clearer this way.
//
// How does the distribution algorith knows how to pick it's people:
//
// - every waypoint has a job prefference ( in file "SilentHunter5\data\Submarine\NSS_Uboat7c\waypoints.txt", at the end of the file )
// - every human has a job ( set from Goblin Editor, from the controller configuration window for that particular "Sapiens" 
//   controller ).
// - the algorith tries to match the human that is best suited for that waypoint - by job prefference and distance from that waypoint.
//   if a suitable humans if not found with the desired job, any free human that is close to that location will do.
//

//
// Commands that are working "specially":
//
// - when issuing a "dive", "surface", "emergency_surface", "crash_dive" command, the crew will do the command, then the submarine will call
//   the "set_depth" command.
//
// - when issuing a "rise_whole_periscope", "lower_whole_periscope" command, the submarine will call lower_periscope, 
//   rise_periscope commands, by case.
//
// - when issuing a "rise_whole_obs_periscope", "lower_whole_obs_periscope" command, the submarine will call lower_obs_periscope, 
//   rise_obs_periscope commands, by case.
//

//
// Sample command:
//
// Ahead_slow - sets ahead slow speed for diesel engines; has priority 1; minimum people 2, maximum people 4;
//
// * there are 4 orders for the maximum amount of people that this command can operate on:
//
// 1. CR_HELM = ss_helmsman - "CR_HELM" is the destination waypoint for this human. the human will try to reach that point.
//                            "ss_helmsman" - is the strategy used by this human. it can be found in directory 
//                            "SilentHunter5\data\Scripts\AI\Crew", in file "set_speed.aix". The file will have the same name as the 
//                            command ( not used in code, just for more logical access to it. )
//
// 2. DER_DE_PORT01 = ss_de_port - the same, waypoint and strategy name.
//
// 3. 4. etc
//
// Ahead_slow 1 2 4 ( CR_HELM = ss_helmsman, DER_DE_PORT01 = ss_de_port, DER_DE_STB01_A = ss_de_stb, CR_CHIEF = ss_chief_eng )
//

//
// Where to find these game commands ? ( as they already exist in-game, we only configure them here )
//
// They can be found in "SilentHunter5\data\Cfg\Commands.cfg"
//


